<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>关联公司</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
<div id="pageInTab" class="pageInTab">
<div class="searchArea">
    <form id="searchBar">
        <div class="fieldset1 clearFix">
           <input type="hidden" name="reCstNm" id="reCstNm" value="" />
           <input type="hidden" name="reCertNo" id="reCertNo" value="" />
           <input type="hidden" name="reMp1" id="reMp1" value="" />
           
            <div class="fieldBox" >
             <div class="label">企业(机构)名称</div>
                <div class="field">
                    <input name="entname" id="entname" type="text" class="ui-textbox" value="${entname}" readOnly>
                </div>
            </div>
            <div class="fieldBox" >
             <div class="label">个体名称</div>
                <div class="field">
                    <input name="name" id="name" type="text" class="ui-textbox" value="${name}" readOnly>
                </div>
            </div>
            <%-- <div class="fieldBox" >
             <div class="label">属性</div>
                <div class="field">
                    <input name="reCertNo" id="reCertNo" type="text" class="ui-textbox" value="${reCertNo}">
                    <select name="relTypCd" id="relTypCd" data-value=" ">
						<option value=" " checked>请选择</option>
						<c:forEach items="${relTypCdMap}" var="kv">
							<option value="${kv.key}">${kv.value}</option>
						</c:forEach>
					</select>
                </div>
            </div>
            <div class="fieldBox" >
             <div class="label">属性性质</div>
                <div class="field">
                    <input name="reIdAddr" id="reIdAddr" type="text" class="ui-textbox" value="${reIdAddr}">
                    <select name="propTypCd" id="propTypCd" data-value=" ">
						<option value=" " checked>请选择</option>
						<c:forEach items="${propTypCdMap}" var="kv">
							<option value="${kv.key}">${kv.value}</option>
						</c:forEach>
					</select>
                </div>
            </div> --%>
           
            <div class="clearFix"></div>
            <div class="btnsBox">
               <span id="searchBtn"  class="sq-button sq-button-round">查询</span>
            </div>
        </div>
    </form>
</div>
<div id="ligergrid1" class="sq-grid"></div> 
</div>
</div>
<script type="text/javascript">
	var _entname = '${entname}';// 企业名称
	var _name = '${name}';// 个体名称
	
	var grid = null;
	//var pageInApp={}; // to 下一级子窗口 接口
    //var pageInTab=null;
	$(function () {
		$("#searchBar").ligerForm();
		var form = new liger.get("searchBar");
		var data = form.getData();
	    $("#ligergrid1").ligerGrid({
	    	url: '<%=path%>/splExecRypossha/initList.do',
	    	method : 'get',
	    	parms:data,
	        columns: [
	             { display: '企业(机构)名称', name: 'entname', align:'left',minWidth: 140 ,
	            	/* render: function (rowdata, rowindex, value, column) { 
            			var h = '';
            			if (rowdata.assTypCd == 6 || rowdata.assTypCd == 99){
            				return value;
            			}
            			if(value&&value!="null"){
	            		    h+='<a href="javascript:relDetailBtn(';
	                        h+="'"+rowdata.relId+"'";
	                        h+=",'" + rowdata.assTypCd + "'";
	                        h+=')">'+value+'</a>'
            			}
                        return h;
            		}, */
	            	enabledSort:true}, 
	             { display: '注册号', name: 'registerno', minWidth: 140 , enabledSort:true}, 
	             { display: '关联关系', name: 'relation', minWidth: 100,align:'center', enabledSort:true},
	             { display: '关联内容', name: 'content', minWidth: 100,align:'center', enabledSort:true},
	             { display: '企业状态', name: 'entstatus', minWidth: 100,align:'center', enabledSort:true},
	             { display: '主体名称', name: 'name', minWidth: 100,align:'center', enabledSort:true},
	        ],
	        pageSize:10,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-20,
	        //isScroll: false,
	        //checkbox:true,
	        delayLoad:true,
	        rownumbers:true,
	    });
	 //   initOrgTree();
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	    $("#searchBar").ligerForm();
	    $("#searchBtn").click(function(event) {
	         var form = new liger.get("searchBar");
	         var data = form.getData();
	         //data["crtTm"] = $("#crtTm").val();
	         for (name in data){
	            grid.setParm(name,data[name]);
	         };
	        grid.reload();
	    });
	
        grid.reload();
	    $("#pageloading").hide();
	});
	
	// 客户详情页
	function cstDetailBtn(_id, _propTypCd){
		//1 自然人  2 法人
		if(_propTypCd == 1){
			parent.mainApp.f_addTab('tab_customer_np_detail'+_id,'客户详情','<%=path%>/customer/cstbscinfo/toCustCstBacInfoNpDetailPage.do?id='+_id);
		}else if(_propTypCd == 2){
			parent.mainApp.f_addTab('tab_customer_corp_detail'+_id,'客户详情','<%=path%>/customer/cstbscinfo/toCustCstBacInfoCorpDetailPage.do?id='+_id);
		}
	}
	
	// 关联详情页
	function relDetailBtn(_id, _assTypCd){
		if (_assTypCd == 1){// 客户
			var _url = '<%=path%>/customer/cstbscinfo/getShowDetailById.do';
	    	AjaxUtils.ajaxGet(_url, {id:_id}, function(msg){
	    		 if(msg.success == 1){
	    			//msg.data.cstTypCd 客户分类（CST0001）
					//1 自然人  2 法人
					if(msg.data.cstTypCd == 1){
						parent.mainApp.f_addTab('tab_customer_np_detail'+_id,'客户详情','<%=path%>/customer/cstbscinfo/toCustCstBacInfoNpDetailPage.do?id='+_id);
					}else if(msg.data.cstTypCd == 2){
						parent.mainApp.f_addTab('tab_customer_corp_detail'+_id,'客户详情','<%=path%>/customer/cstbscinfo/toCustCstBacInfoCorpDetailPage.do?id='+_id);
					}
				 }else{
					 UIUtils.alertError(msg.info);
				 }
	    	},true);
		}
		if (_assTypCd == 2){// 供应商
			var _url = '<%=path%>/product/splInfo/getById.do';
	    	$.ajax({
	    		type: 'get',
	    		dataType:'json',
	    		data:{id:_id},
	    		url: _url,
	    		success:function(msg){
	    			 if(msg.success == 1){
	    				 if (msg.data.splAttrCd == null){
	    					 console.log('splAttrCd = null');
		    				 parent.mainApp.f_addTab('PrdSpl_3'+_id,'供应商详情','<%=path%>/product/splInfo/toDetailPage.do?id='+_id);
	    				 } else {
		    				 parent.mainApp.f_addTab('PrdSpl_3'+_id,'供应商详情','<%=path%>/product/splInfo/toDetailPage.do?id='+_id+'&splAttrCd=' + msg.data.splAttrCd);
	    				 }
	    			 }else{
	    				 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
	    			 }
	    		}
	    	});
		}
		if (_assTypCd == 3){// 挂靠公司
			parent.mainApp.f_addTab('tab_prj_lnk_comp_detail' + _id, '挂靠公司详情', '<%=path%>/project/prjlnkcomp/toDetailPage.do?id=' + _id);
		}
		if (_assTypCd == 4){// 厂商
			parent.mainApp.f_addTab('PrdMfr_3'+_id,'厂商详情','<%=path%>/product/mfrInfo/toDetailPage.do?id='+_id);
		}
		if (_assTypCd == 5){// 担保人
			var _url = '<%=path%>/customer/cstbscinfo/getShowDetailById.do';
	    	AjaxUtils.ajaxGet(_url, {id:_id}, function(msg){
	    		 if(msg.success == 1){
	    			//msg.data.cstTypCd 客户分类（CST0001）
					//1 自然人  2 法人
					if(msg.data.cstTypCd == 1){
						parent.mainApp.f_addTab('tab_customer_np_detail'+_id,'客户详情','<%=path%>/customer/cstbscinfo/toCustCstBacInfoNpDetailPage.do?id='+_id);
					}else if(msg.data.cstTypCd == 2){
						parent.mainApp.f_addTab('tab_customer_corp_detail'+_id,'客户详情','<%=path%>/customer/cstbscinfo/toCustCstBacInfoCorpDetailPage.do?id='+_id);
					}
				 }else{
					 UIUtils.alertError(msg.info);
				 }
	    	},true);
		}
	}
	    
	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		}
		return dateStr;
	}
	
</script>

</body>
</html>